<template>
    <div id="product" class="box">
        <div class="product--header has-text-centered">
            <i class="fa fa-2x fa-user-circle"></i>
        </div>
        <div class="product-list">
            <div
                v-for="productItem in productItems"
                :key="productItem.id"
                class="product-list--item">
                <product-list-item :product-item="productItem"></product-list-item>
            </div>
        </div>
        <div class="product-count has-text-right">
            <span class="has-text-weight-bold"># of products: 4</span>
        </div>
    </div>
</template>

<script lang="ts">
import {Component, Prop, Vue} from 'vue-property-decorator'
import {productStore} from "@/store/product/ProductStore";
import ProductListItem from "@/components/product/ProductListItem.vue";

@Component({
    components: {ProductListItem}
})
export default class ProductList extends Vue {
    name = 'ProductList';

    private get productItems() {
        return productStore.getAllProducts;
    }

    created() {
        productStore.getProductItems();
    }
}
</script>

<style scoped>
.box{
    border:1px solid #c0c0c0;
}
.products--header {
    border-bottom: 1px solid #E8E8E8;
    padding-bottom: 15px;
}

.product-list {
    padding-top: 10px;
}

.product-list--item {
    padding: 10px 0;
}
</style>
